from aoct import Aoct_Model
import torch
from os.path import join, dirname
import numpy as np
from reader import load_audio
import datetime
import time
import get_result
import Globaldata
def initModel(device = 'cpu', model_path = 'assets/2024-6-29-22121.pth'):
    device = torch.device(device=device)
    Globaldata.initmodel = Aoct_Model().to(device)
    Globaldata.initmodel.load_state_dict(torch.load(join(dirname(__file__), model_path), map_location=device))
    Globaldata.initmodel.eval()
    initSuccess = Globaldata.initmodel(torch.zeros((1, 1, 255, 255)).to(device))
    print(Globaldata.initmodel.leaner1.bias)
    print(initSuccess)
    Globaldata.initTest = "initSuccess"
    get_result.test()
    return "init success"
